const middlewares = []
const use = function (fn) {
  middlewares.push(fn)
}

use(async (ctx, next) => {
  console.log('1号开始')
  await next()
  console.log('1号结束')
})

use(async (ctx, next) => {
  console.log('2号开始')
  // await next()
  console.log('2号结束')
})
use(async (ctx, next) => {
  console.log('3号开始')
  await next()
  console.log('3号结束')
})
function next(){
  return function(){
    console.log('next')

  }
}
async function fn (ctx,next){
  console.log('1号开始')
  await next()
  console.log('1号结束')
}
fn(null,next())
